/**
 * Created by RockeyCai on 16/3/14.
 */
var _ = require('underscore');
var cheerio = require('cheerio');
var superagent = require('superagent');
var async = require('async');
var mkdirp = require('mkdirp');
var fs = require('fs');
var http = require('http');

//var name = "a a a a"
//name = name.replace(/ /g , "_")
//
//console.log(name);


var url = "http://www.easyicon.net/download/png/521087/128/"

superagent
  .get(url)
  .set("X-Forwarded-For" , "10.111.198.90")
  .end(function (err, sres) {
  if (err) {
    console.log(err)
    return;
  }
  //console.log(sres.body);
  fs.writeFile("./a.png", sres.body, 'binary', function (err) {
    if (err) throw err;
    console.log('file saved');
  });
})

